<template>
  <div class="app-container">
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-search"
          size="mini"
          @click="handleSearch"
          >搜索</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['repertory:blzmMstr:insert']"
          >新增</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['repertory:blzmMstr:update']"
        >
          修改
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="single"
          @click="handleDelete"
          v-hasPermi="['repertory:blzmMstr:delete']"
        >
          删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-circle-check"
          size="mini"
          :disabled="single"
          @click="handleSubmit"
          v-hasPermi="['repertory:blzmMstr:submit']"
        >
          提交
        </el-button>
      </el-col>
      <!--颜色状态标识-->
      <Tag type="dot" size="default" color="#0fac09">提交</Tag>
      <Tag type="dot" size="default" color="#0323af">审核</Tag>
      <Tag type="dot" size="default" color="#bb0331">过账</Tag>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      @scrollBottom="load"
      highlight-current-row
      border
      stripe
      v-loading="loading"
      :data="ktmMstrList"
      @row-click="clickBlzm"
      :height="tableH"
      :row-class-name="row_type"
      :header-cell-style="{ 'text-align': 'center' }"
    >
      <el-table-column label="#" width="40" type="index" align="center" />
      <el-table-column
        label="转入单号"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzmDjbh"
        width="120"
      />
      <el-table-column
        label="仓库"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzmCkdm"
        width="100"
      >
        <template #default="scope">
          <dict-tag :options="allStorageOptions" :value="scope.row.blzmCkdm" />
        </template>
      </el-table-column>
      <el-table-column
        label="解封/封存"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzmFlag"
        width="100"
      >
        <template #default="scope">
          <dict-tag :options="BlzmFlagOptions" :value="scope.row.blzmFlag" />
        </template>
      </el-table-column>
      <el-table-column
        label="封存/解封原因"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzmDesc"
      />
      <el-table-column
        label="撤回原因"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzmNgdesc"
      />
      <el-table-column
        label="开单人员"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzmJlry"
        width="100"
      />
      <el-table-column
        label="开单日期"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzmJlrq"
        width="130"
      />
      <el-table-column
        label="确认人员"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzmShry"
        width="100"
      />
      <el-table-column
        label="确认日期"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzmShrq"
        width="130"
      />
      <el-table-column
        label="过账人员"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzmGzry"
        width="100"
      />
      <el-table-column
        label="过账日期"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzmGzrq"
        width="130"
      />
      <el-table-column
        label="操作"
        align="center"
        fixed="right"
        class-name="small-padding fixed-width"
        width="100"
      >
        <template #default="scope">
          <el-button
            size="mini"
            type="text"
            @click="handleAddFull(scope.row)"
            :disabled="scope.row.blzmZtbz != 1 || scope.row.blzmTjflag != 0"
            v-hasPermi="['repertory:blzmMstr:update']"
          >
            添加物料
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <!--库存转入子项明细-->
    <el-table
      :height="tableHChild"
      stripe
      border
      size="mini"
      highlight-current-row
      v-loading="loading"
      :data="blzdDetList"
    >
      <el-table-column
        fixed
        label="#"
        type="index"
        width="55px"
        align="center"
        prop="level"
      />
      <el-table-column
        label="物料代码"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzdWldm"
        width="110"
      />
      <el-table-column
        label="规格描述"
        :show-overflow-tooltip="true"
        align="center"
        prop="itmPmgg"
      />
      <el-table-column
        label="客户编码"
        :show-overflow-tooltip="true"
        align="center"
        prop="itmCustwldm"
      />
      <el-table-column
        label="单位"
        :show-overflow-tooltip="true"
        align="center"
        prop="itmDw"
        width="50"
      >
        <template #default="scope">
          <dict-tag :options="unitFlagOptions" :value="scope.row.itmDw" />
        </template>
      </el-table-column>
      <el-table-column
        label="存放位置"
        align="center"
        prop="blzdCwdm"
        width="150"
      >
        <template #default="scope">
          <dict-tag :options="allCwOptions" :value="scope.row.blzdCwdm" />
        </template>
      </el-table-column>
      <el-table-column
        label="转入数量"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzdZrsl"
        width="80"
      />
      <el-table-column
        label="转入状态"
        align="center"
        prop="blzdZtbz"
        width="100"
      >
        <template #default="scope">
          <dict-tag :options="lbmTypeOptions" :value="scope.row.blzdZtbz" />
        </template>
      </el-table-column>
      <el-table-column
        label="备注"
        :show-overflow-tooltip="true"
        align="center"
        prop="blzdDesc"
      />
      <el-table-column
        label="操作"
        align="center"
        width="80"
        class-name="small-padding fixed-width"
      >
        <template #default="scope">
          <el-button
            size="mini"
            type="text"
            v-hasPermi="['repertory:blzmMstr:update']"
            @click="delKtd(scope.row)"
            :disabled="single"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <!-- 查询对话框   -->
    <el-dialog
      :title="title"
      v-model="openSearch"
      :close-on-click-modal="false"
      draggable
      width="450px"
      append-to-body
    >
      <el-form
        :model="queryParams"
        ref="queryForm"
        :inline="true"
        v-show="showSearch"
        label-width="88px"
      >
        <el-col :span="24">
          <el-form-item label="转入单号" prop="blzmDjbh">
            <el-input
              v-model="queryParams.blzmDjbh"
              placeholder="请输入转入单号"
              clearable
              size="small"
              style="width: 240px"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="仓库" prop="blzmCkdm">
            <el-input
              v-model="queryParams.blzmCkdm"
              placeholder="请输入仓库"
              clearable
              size="small"
              style="width: 240px"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="开单日期">
            <el-date-picker
              v-model="daterangeblzmJlrq"
              size="small"
              style="width: 240px"
              value-format="yyyy-MM-dd HH:mm:ss"
              :default-time="['00:00:00', '23:59:59']"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            ></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="24" style="text-align: center">
          <el-form-item>
            <el-radio-group v-model="queryParams.blzmTjflag">
              <el-radio label="0">未提交</el-radio>
              <el-radio label="1">已提交</el-radio>
              <el-radio label="">全部</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item
            style="margin-top: 25px; display: flex; justify-content: flex-end"
          >
            <el-button @click="cancel">取消</el-button>
            <el-button type="primary" @click="handleQuery">确认</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-dialog>

    <!-- 添加子项对话框   -->
    <el-dialog
      v-model="openChildren"
      :fullscreen="true"
      :close-on-click-modal="false"
      append-to-body
    >
      <!-- 子项搜索条件框-->
      <el-form :model="queryChildrenParams" :inline="true">
        <el-row>
          <el-col :span="6">
            <el-form-item label="物料代码" prop="blzdWldm">
              <el-input
                v-model="queryChildrenParams.blzdWldm"
                placeholder="请输入物料代码"
                clearable
                size="small"
                @keyup.enter.native="serachChildrened"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="规则描述" prop="itmPmgg">
              <el-input
                v-model="queryChildrenParams.itmPmgg"
                placeholder="请输入规则描述"
                clearable
                size="small"
                @keyup.enter.native="serachChildrened"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item style="display: flex; justify-content: flex-end">
              <el-button type="primary" @click="serachChildrened"
                >查询</el-button
              >
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <!--子项数据框-->
      <el-form>
        <el-table
          highlight-current-row
          v-loading="loading"
          :data="serachAddList"
          border
          stripe
          :height="tableH"
          ref="somCheckTable"
          @scrollBottom="load2"
          :header-cell-style="{ 'text-align': 'center' }"
        >
          <el-table-column
            label="#"
            min-width="5%"
            type="index"
            align="center"
          />
          <!-- <el-table-column type="selection" min-width="5%" align="center" /> -->
          <el-table-column
            label="物料代码"
            min-width="20%"
            :show-overflow-tooltip="true"
            align="center"
            prop="blzdWldm"
          />
          <el-table-column
            label="客户物料代码"
            min-width="20%"
            :show-overflow-tooltip="true"
            align="center"
            prop="itmCustwldm"
          />
          <el-table-column
            label="规格描述"
            min-width="30%"
            :show-overflow-tooltip="true"
            prop="itmPmgg"
          />
          <el-table-column
            label="单位"
            min-width="10%"
            :show-overflow-tooltip="true"
            align="center"
            prop="itmDw"
          >
            <template #default="scope">
              <dict-tag :options="unitFlagOptions" :value="scope.row.itmDw" />
            </template>
          </el-table-column>
          <el-table-column
            label="存放位置"
            min-width="12%"
            align="center"
            prop="blzdCwdm"
          >
            <template #default="scope">
              <dict-tag :options="allCwOptions" :value="scope.row.blzdCwdm" />
            </template>
          </el-table-column>
          <el-table-column
            label="库存数量"
            min-width="10%"
            :show-overflow-tooltip="true"
            align="center"
            prop="blzdKcsl"
          />
          <el-table-column
            label="转入数量"
            width="100"
            :show-overflow-tooltip="true"
            prop="blzdZrsl"
            align="center"
          >
            <template #default="scope">
              <el-input
                class="inputName"
                type="number"
                @input="
                  (e) => {
                    changValue(scope.row, e);
                  }
                "
                v-model="scope.row.blzdZrsl"
              ></el-input>
            </template>
          </el-table-column>
        </el-table>

        <el-form-item
          style="margin-top: 25px; display: flex; justify-content: flex-end"
        >
          <el-button @click="cancel">取消</el-button>
          <el-button type="primary" @click="handAddChildren">确认</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 添加或修改库存转入对话框 -->
    <el-dialog
      :title="title"
      v-model="open"
      :close-on-click-modal="false"
      draggable
      width="550px"
      append-to-body
    >
      <el-form ref="form" :model="form" :rules="rules" label-width="110px">
        <el-form-item label="转入单号" prop="blzmDjbh">
          <el-input
            v-model="form.blzmDjbh"
            placeholder="流水单号生成"
            disabled
          />
        </el-form-item>
        <el-form-item label="仓库" prop="blzmCkdm">
          <el-select v-model="form.blzmCkdm" placeholder="请选择仓库" clearable>
            <el-option
              v-for="item in storageOptions"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="状态" prop="blzmFlag">
          <el-radio-group v-model="form.blzmFlag">
            <el-radio :label="'0'" :value="'0'">封存</el-radio>
            <el-radio :label="'1'" :value="'0'">解封</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="封存/解封原因" prop="blzmDesc">
          <el-input
            type="textarea"
            v-model="form.blzmDesc"
            placeholder="请输入封存/解封原因"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="submitForm">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listMstr,
  getMstr,
  delMstr,
  addMstr,
  updateMstr,
  getNeedData,
  addNeedData,
  listBlzd,
  submitBlzm,
  exportMstr,
  delBlzd,
} from "@/api/repertory/blzmMstr";
import {
  getAll,
  getFinishedOrSemiFinishedProduct,
  getStorageBl,
} from "@/api/repertory/Storage";
import ColorKc from "@/components/kcManage/colorKc/index";

export default {
  name: "blzmMstr",
  components: {
    ColorKc,
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      //页面布局
      tableH: (document.body.clientHeight - 130) / 2,
      tableHChild: (document.body.clientHeight - 280) / 2,
      // 点中的单据
      clickBlzmNstr: [],
      // 非单个禁用
      single: true,
      // 显示搜索条件
      showSearch: true,
      openSearch: false,
      // 显示添加物料模态对话框
      openAddChild: false,
      // 总条数
      total: 0,
      total2: 0,
      serachAddList: [],
      // 库存转入主表数据
      ktmMstrList: [],
      // 库存转入明细数据
      blzdDetList: [],
      // 弹出层标题
      title: "",
      lbmTypeOptions: [
        {
          dictValue: "1",
          dictLabel: "新增",
          listClass: "default",
        },
        {
          dictValue: "2",
          dictLabel: "过账成功",
          listClass: "default",
        },
      ],
      // 是否显示弹出层
      open: false,
      openChildren: false,
      // 开单日期时间范围
      daterangeblzmJlrq: [
        this.$moment().startOf("month").toDate(),
        this.$moment().add(100, "year").endOf("month").toDate(),
      ],
      unitFlagOptions: [],
      allCwOptions: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 30,
        blzmDjbh: null,
        blzmCkdm: null,
        blzmJlrq: null,
        blzmTjflag: "0",
      },
      // 子项查询参数
      queryChildrenParams: {
        pageNum: 1,
        pageSize: 30,
        blzdDjbh: null,
        blzdCwdm: null,
        blzdWldm: null,
        blzdFlag: null,
        itmPmgg: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        blzmCkdm: [
          { required: true, message: "仓库不能为空", trigger: "blur" },
        ],
        blzmDesc: [
          { required: true, message: "封存/解封原因不能为空", trigger: "blur" },
        ],
        blzmFlag: [
          { required: true, message: "请选择封存/解封", trigger: "blur" },
        ],
      },
      /** 字典数据 **/
      //有效仓库字典
      storageOptions: [],
      //所有仓库字典
      allStorageOptions: [],
      BlzmFlagOptions: [
        { dictLabel: "封存", listClass: "default", dictValue: "0" },
        { dictLabel: "解封", listClass: "default", dictValue: "1" },
      ],
    };
  },
  created() {
    getAll().then((response) => {
      this.allCwOptions = response.data;

      for (let item2 of this.allCwOptions) {
        item2.dictLabel = item2.storageDefaultstorage;

        item2.listClass = "default";
        item2.dictValue = item2.storageId + "";
      }
    });
    //单位
    this.getDicts("sys_unit").then((response) => {
      this.unitFlagOptions = response.data;
    });

    //全部的获取成品/半成品/不良仓库
    getStorageBl(0).then((response) => {
      this.allStorageOptions = response.data;
      for (let item of this.allStorageOptions) {
        item.dictLabel = item.storageName;
        item.listClass = "default";
        item.dictValue = item.storageId + "";
      }
    });
    //有效的
    getFinishedOrSemiFinishedProduct().then((response) => {
      this.storageOptions = response.data;
      for (let item of this.storageOptions) {
        item.dictLabel = item.storageName;
        item.listClass = "default";
        item.dictValue = item.storageId + "";
      }
    });

    this.getList();
  },
  methods: {
    /** 查询库存转入列表 */
    getList(row) {
      this.loading = true;
      this.queryParams.params = {};
      if (null != this.daterangeblzmJlrq && "" != this.daterangeblzmJlrq) {
        this.queryParams.params["beginblzmJlrq"] = this.moment(
          this.daterangeblzmJlrq[0]
        ).format("YYYY-MM-DD HH:mm:ss");
        this.queryParams.params["endblzmJlrq"] = this.moment(
          this.daterangeblzmJlrq[1]
        ).format("YYYY-MM-DD HH:mm:ss");
      }
      this.queryParams.pageNum = 1;
      listMstr(this.queryParams).then((response) => {
        this.ktmMstrList = [];
        this.ktmMstrList = this.ktmMstrList.concat(response.rows);
        this.total = response.total;
        this.loading = false;
        if (row != null) {
          this.clickBlzm(row);
        } else if (this.ktmMstrList != null && this.ktmMstrList.length > 0) {
          this.clickBlzm(this.ktmMstrList[0]);
        } else {
          this.blzdDetList = [];
        }
      });
    },
    row_type(row) {
      let type = "";
      switch (row.row.blzmZtbz) {
        case "6":
          type = "past";
          break;
        case "2":
          type = "jianyan";
          break;
        default:
          if (row.row.blzmTjflag === "1") {
            type = "submit";
          }
      }
      return type;
    },
    //load
    load() {
      if (
        this.queryParams.pageNum <
        Math.ceil(this.total / this.queryParams.pageSize)
      ) {
        this.queryParams.pageNum++;
        listMstr(this.queryParams).then((response) => {
          this.ktmMstrList = this.ktmMstrList.concat(response.rows);
          this.total = response.total;
          this.loading = false;
        });
      }
      return 0;
    },

    /** 单击选中单据事件 */
    clickBlzm(row) {
      if (row != null) {
        this.clickBlzmNstr = row;
        this.single = row == null || row.blzmZtbz != 1 || row.blzmTjflag != 0;
        this.getblzdDetList(row.blzmDjbh);
      }
    },
    /** 根据转入单号获取明细数据 */
    getblzdDetList(blzdDjbh) {
      this.blzdDetList = [];
      listBlzd(blzdDjbh).then((res) => {
        this.blzdDetList = res.data;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.openSearch = false;
      this.openChildren = false;
      this.reset();
    },
    handAddChildren() {
      const tmpArr = this.serachAddList.filter((a) => !!a.blzdZrsl);
      addNeedData(tmpArr)
        .then((response) => {
          this.serachChildrened();
          this.msgSuccess("添加成功");
        })
        .then(() => {
          this.getList();
        })
        .catch(() => {});
    },
    // 表单重置
    reset() {
      this.form = {
        blzmId: null,
        blzmDjbh: null,
        blzmCkdm: null,
        blzmFlag: null,
        blzmDesc: null,
        blzmTjflag: null,
        blzmZtbz: null,
        blzmNgdesc: null,
        blzmJlry: null,
        blzmJlrq: null,
        blzmShry: null,
        blzmShrq: null,
        blzmGzry: null,
        blzmGzrq: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.ktmMstrList = [];
      this.getList();
      this.openSearch = false;
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeblzmJlrq = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加";
    },
    /** 修改按钮操作 */
    handleUpdate() {
      this.reset();
      const blzmId = this.clickBlzmNstr.blzmId;
      getMstr(blzmId).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改";
      });
    },
    handleSearch() {
      this.reset();
      this.title = "查询";
      this.openSearch = true;
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.blzmId != null) {
            updateMstr(this.form).then((response) => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addMstr(this.form).then((response) => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete() {
      const blzmDjbhs = this.clickBlzmNstr.blzmDjbh;
      const blzmIds = this.clickBlzmNstr.blzmId;
      this.$confirm(
        '是否确认删除转入单号: <"' + blzmDjbhs + '" >及其数据?',
        "警告",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(function () {
          return delMstr(blzmIds);
        })
        .then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 提交按钮操作 **/
    handleSubmit() {
      if (this.clickBlzmNstr.blzmDjbh != null) {
        listBlzd(this.clickBlzmNstr.blzmDjbh).then((res) => {
          if (res.data.length > 0) {
            getMstr(this.clickBlzmNstr.blzmId).then((res) => {
              const datas = res.data;
              if (datas.blzmZtbz != 1 || datas.blzmTjflag != 0) {
                this.msgError(
                  "单据: <" +
                    this.clickBlzmNstr.blzmDjbh +
                    "> 不是开单状态,请重新查询该单据~"
                );
                return;
              } else {
                submitBlzm(this.clickBlzmNstr.blzmDjbh).then((res) => {
                  this.msgSuccess("单据提交成功~");
                  this.getList();
                });
              }
            });
          } else {
            this.msgError(
              "单据: " +
                this.clickBlzmNstr.blzmDjbh +
                " 无转入明细物料,无法提交~"
            );
          }
        });
      } else {
        this.msgError("请先选中需要提交的单据~");
      }
    },
    //添加对话框
    handleAddFull(row) {
      this.openChildren = true;
      this.queryChildrenParams.blzdDjbh = row.blzmDjbh;
      this.queryChildrenParams.blzdFlag = row.blzmFlag;
      this.queryChildrenParams.blzdCwdm = row.blzmCkdm;
      this.serachChildrened();
    },
    changValue(row, e) {
      if (row.blzdZrsl < 0) {
        this.msgError("不允许输入负数");
        e = 0;
        row.blzdZrsl = 0;
      }
      if (row.blzdZrsl > row.blzdKcsl) {
        this.msgError("不允许超出库存数量");
        row.blzdZrsl = row.blzdKcsl;
      }
    },
    /** 查询子项 */
    serachChildrened() {
      this.queryChildrenParams.pageNum = 1;
      getNeedData(this.queryChildrenParams).then((response) => {
        this.serachAddList = [];
        this.serachAddList = this.serachAddList.concat(response.rows);
        this.total2 = response.total;
      });
    },
    load2() {
      if (
        this.queryChildrenParams.pageNum <
        Math.ceil(this.total2 / this.queryChildrenParams.pageSize)
      ) {
        this.queryChildrenParams.pageSize = 30;
        this.queryChildrenParams.pageNum++;
        getNeedData(this.queryChildrenParams).then((response) => {
          this.serachAddList = this.serachAddList.concat(response.rows);
          this.total2 = response.total;
        });
      }
      return 0;
    },
    /** 删除子项按钮操作 **/
    delKtd(row) {
      delBlzd(row.blzdId)
        .then((res) => {
          this.getblzdDetList(row.blzmDjbh);
          this.msgSuccess("删除成功");
        })
        .catch(() => {
          this.msgError("删除失败");
        });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm("是否确认导出所有库存转入数据项?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.exportLoading = true;
          return exportMstr(queryParams);
        })
        .then((response) => {
          this.download(response.msg);
          this.exportLoading = false;
        })
        .catch(() => {});
    },
  },
};
</script>

<style lang="scss" scoped></style>
